package com.example.libraryapp.activity.register;

import com.example.libraryapp.bean.User;
import com.example.libraryapp.bean.response.BaseResponse;
import com.example.libraryapp.network.base.BaseHttpHandler;
import com.example.libraryapp.network.base.BasePresenter;

/**
 * @author 伍凯铭
 * @since 2020/6/19
 */
public class RegisterPresenterIml extends BasePresenter<RegisterContract.View> implements RegisterContract.Presenter{

    @Override
    public void doRegister(User user) {
        super.doRequest(getRequestService().register(user),new RegisterHandler());
    }

    class RegisterHandler extends BaseHttpHandler<BaseResponse> {

        RegisterHandler() {
            super(mView);
        }

        @Override
        public void onSuccess(BaseResponse response) {
            if(mView != null) {
                mView.showContent();
                mView.showRegister(response);
            }
        }
    }
}
